import pandas as pd
from collections import defaultdict
import numpy as np

if __name__ == '__main__':
    # 输入数据列表
    data_list = [1, 2, 3, 4, 6, 6, 76, 87, 64, 34, 1]

    # 初始化字典，用于存储每个数字及其出现的间隔序列
    intervals_dict = defaultdict(list)

    # 记录每个数字的出现顺序
    prev_num = None
    for i, num in enumerate(data_list):
        if prev_num is not None:
            # 计算当前数字与前一个数字之间的间隔
            interval = i - prev_index
            intervals_dict[num].append(interval)

        prev_num = num
        prev_index = i

    # 输出每个数字及其对应的间隔序列
    for num, intervals in intervals_dict.items():
        print(f"Number: {num}, Intervals: {intervals}")

